#!/bin/bash

# FTP客户端测试脚本

echo "==================================="
echo "    FTP客户端连接测试"
echo "==================================="

echo "可用的测试用户："
echo "1. ftpuser / ftppass123"
echo "2. admin / admin123"
echo ""

echo "测试命令示例："
echo "ftp localhost 21"
echo "或者使用 lftp："
echo "lftp ftp://ftpuser:ftppass123@localhost:21"
echo ""

echo "常用FTP命令："
echo "- ls          # 列出文件"
echo "- pwd         # 显示当前目录"
echo "- cd <dir>    # 切换目录"
echo "- put <file>  # 上传文件"
echo "- get <file>  # 下载文件"
echo "- quit        # 退出"
echo ""

echo "Web监控界面："
echo "http://localhost:8080/api/ftp/status"
echo "http://localhost:8080/api/ftp/health"
echo ""

# 检查FTP服务是否运行
if nc -z localhost 21 2>/dev/null; then
    echo "✅ FTP服务器正在运行 (端口21)"
else
    echo "❌ FTP服务器未运行，请先启动服务器"
fi

if nc -z localhost 8080 2>/dev/null; then
    echo "✅ Web监控服务正在运行 (端口8080)"
else
    echo "❌ Web监控服务未运行"
fi
